{* $Id$ *}
{include file="admin/lib/header.html" title="帮助中心管理"}
<div class="page-header border-bottom clearfix">
  <h2 class="left">帮助中心管理<span>{if $info}编辑{else}添加{/if}帮助中心</span></h2>
  <a href="{AnUrl('help_center/admin')}" class="btn btn-default btn-sm right">&lt;&nbsp;返回帮助中心列表</a>
</div>
<!--start:帮助中心新增-->
<div class="add-form">
  <form class="js_creatForm" action="{AnUrl('help_center/admin/create')}" method="post" enctype="multipart/form-data">
    <table class="table" cellpadding="0" cellspacing="0">
      <tr>
      	<select name="help_center[type]" id="">
      		<option value="" selected>请选择帮助中心分类</option>
            {foreach $help_type_list as $k=>$v}
              <option value="{$k}" {if $helper_center_info['type'] == $k}selected {/if}>{$v}</option>
            {/foreach}
          </select>
      </tr>
      <tr>
        <th style="width:200px;"><label for="" class="add-f-label">标题：</label></th>
        <td>
          <div>
            <input name="help_center[title]" style="width:490px;" type="text" class="add-f-ipt1" value="{$help_center_info['title']}" placeholder="请输入帮助中心标题" >
          </div>
        </td>
      </tr>
      <tr>
        <th><label for="" class="add-f-label">帮助中心内容：</label></th>
        <td>
            <script type="text/javascript">
            var ue = UE.getEditor('help_center_content', {
            	'initialFrameWidth'  : 800, 
            	'initialFrameHeight' : 400,
            });           
            </script>
            <!--<script id="help_center_content" name="help_center[content]" type="text/plain"></script> -->
            <textarea class="help_center_content" name="help_center[content]" id="js_editor" style="width:490px;">{$help_center_info.content}</textarea>
        </td>
      </tr>
      <tr>
        <th>&nbsp;</th>
        <td class="noborder">
          <button type="submit" class="btn btn-success js_submit">&nbsp;&nbsp;&nbsp;确认&nbsp;&nbsp;&nbsp;</button>
        </td>
      </tr>

    </table>
  </form>
</div>
<!--end:帮助中心新增-->
<script>



$(function(){
	
	$('.js_creatForm').submit(function(){
		//表单验证
		if(!$('input[name="help_center[title]"]').val() ){
			showMsg('标题不能为空!');
			return false;
		}

		if(!$('textarea[name="help_center[content]"]').val()){
			showMsg('内容不能为空!');
			return false;
		}
        if(!$('select[name="help_center[type]"]').val()){
      	   showMsg('未选择分类!');
    	   return false;
        }
	   
	});
	
	// 初始化编辑器
	  var editor = new UE.ui.Editor({
	    serverUrl:"{AnUrl('core/handler/file_uploader?source=ueditor&file_field=Filedata')}",
	       initialFrameWidth:820,
	       initialFrameHeight:450,
	       elementPathEnabled:false,
	       autoHeightEnabled: false,
	       autoFloatEnabled: false,
	       wordCount: false,
	       toolbars:[['fullscreen','source', "undo","redo","justifyleft","justifycenter","justifyright","justifyjustify","lineheight","bold","italic","underline","strikethrough","fontsize","fontfamily","backcolor","forecolor","superscript","subscript","insertorderedlist","insertunorderedlist","insertimage","inserttable","emotion","spechars","unlink","link"],[]]
	   });
	  editor.render("js_editor");
	
});
</script>
{include_core file="admin/lib/footer.html"}